package com.ezmobo.advice;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

public class LogHelper {

	public void beforeLog(JoinPoint point) {
		Object[] args = point.getArgs();
		for (int i = 0; i < args.length; i++) {
			System.out.println(args[i]);
		}

		System.out.println("This is beforeLog....");
	}

	public void afterLog(JoinPoint point) {
		System.out.println("This is afterLog....");
	}

	public void afterReturning(JoinPoint point) {

		System.out.println("This is afterReturning...." + 1);
	}

	public void afterThrowing(JoinPoint point) {
		System.out.println("This is afterThrowing....");
	}

	public Object around(ProceedingJoinPoint pjp) throws Throwable {

		// start stopwatch

		Object retVal = pjp.proceed();

		System.out.println(retVal);
		// stop stopwatch

		return retVal;
	}
}
